package org.hibernate.tutorial.hbm;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class TeacherTest {
	public static void main(String[] args) {
		Teacher teacher = new Teacher();
		/*teacher.setId(1);
		teacher.setName("Teacher1");*/
		teacher.setTitle("中级教师");
		@SuppressWarnings("deprecation")
		SessionFactory sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
		Session session = sessionFactory.openSession();
		session.beginTransaction();
		session.save(teacher);
		session.getTransaction().commit();
		session.close();
		sessionFactory.close();
	}
}
